﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGS.Standard.CardSelector;

namespace SGS.Standard.Actor.HumanAnswerActor
{
    public class SelectOtherCardsAnswerActor : ActorBase
    {
        public SelectOtherCardsAnswerActor( int selectedID )
        {
            SelectedID = selectedID;
        }

        public override string ActocName
        {
            get { return "选择某玩家的牌-用户应答"; }
        }

        public int SelectedID
        {
            get;
            set;
        }

        public static new ActorBase Default
        {
            get
            {
                return new DiscardStageHumanAnswerActor( null );
            }
        }

        public override bool CheckHumanActor( EventArgs.HumanActorEventArgs eq )
        {
            var mapping = ((eq.SourceActor) as SelectOtherCardsActor).HiddenCardMapping;
            if (mapping.MappingResult.Count == 0)
            {
                // 此情况应该为逻辑错误，不当出现此情况
                throw new Exception( "Error, mapping.MappingResult.Count can't be zero" );
            }

            return mapping.MappingResult.Where( p => p.UniqueID == SelectedID 
                && p.Privilege != MappingPrivilege.Invalid ).Count() > 0;
        }
    }
}
